package org.vincen.helloworld.rubbish;

import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * String相关代码
 * 
 * @author vincen
 */
public class R20120423 {

	public static void main(String[] args) {
		s4();
	}

	public static void s1() {
		String ss = "192.168.0.4";
		String[] s = ss.split("\\.");
		System.out.println(s.length);

		String[] s1 = { "abc", "eee", "hhh", "aee", "sfa", "aff", "bdf", "abd" };
		String[] s2 = { "eee", "abc", "hhh" };
		Arrays.sort(s2);
		for (String temp : s1) {
			if (Arrays.binarySearch(s2, temp) >= 0) {
				System.out.println(temp);
			}
		}
	}

	public static void s2() {
		String name1 = "ojdbc6-ojdbc6-1.0";
		String name2 = "org.vincen.springapp-baseframework-1.3";
		StringTokenizer stringTokenizer = new StringTokenizer(name2, "-");
		System.out.println(stringTokenizer.countTokens());
	}

	public static void s3() {
		String jpql = String
				.format("select new %3$s(a.deptId, a.deptName, (select count(*) from %2$s b where b.deptId= a.deptId) as totalCount) from %1$s a",
						"gao1", "xing2", "xyz3");
		System.out.println(jpql);

	}
	
	public static void s4(){
		StringBuilder builder = new StringBuilder();
		builder.append("1,");
		builder.append("2,");
		builder.append("3,");
		int capacity = builder.capacity();
		int length = builder.length();
		System.out.println(capacity);
		System.out.println(length);
		System.out.println(builder.deleteCharAt(builder.length() - 1));
	}
}
